<?php

namespace App\Http\Controllers\Web;

use App\Http\Controllers\Controller;
use App\Models\About;
use App\Models\Configs;
use App\Models\Honor;
use Illuminate\Http\Request;

class CompanyController extends Controller
{
    // 系统配置参数
    public function configs()
    {
        $data = Configs::where('group', 'system')->get()->toArray();
        $result = array_reduce($data, function ($acc, $item) {
            $acc[$item['key']] = $item['value'];
            return $acc;
        }, []);
        return $this->successful($result);
    }

    // 企业简介
    public function profile()
    {
        return About::where('type', 'company')->get();
    }

    // 企业声音定制
    public function sounds()
    {
        return About::where('type', 'sounds')->get();
    }

    // 企业荣誉
    public function honor()
    {
        return Honor::where('hide', 0)->latest('orderby')->get();
    }
}
